import {
    alignData,
    BooleanData,
    sortData,
    tableFixedData,
    TableFuncMetas,
    TableSizeData
} from "@/components/OptionsMetaData";
import {EventBus, EventType, FunEventType} from "@/event";
const pagination = {showSizeChanger: true, total: 30, pageSizeOptions: ['10', '30', '50', '80', '100']};

const PaginationData = [
    {label: '否', value: false},
    {label: '是', value: pagination},
]
export const TableMetas = [
    // {field: 'title', title: '标题', type: "text"},
    {field: 'pagination', title: '是否分页', type: 'radio', data: PaginationData, default: pagination},
    {field: 'bordered', title: '显示边框', type: 'radio', data: BooleanData, default: true},
    {field: 'size', title: '尺寸', type: "radio", data: TableSizeData, default: 'middle'},
    {field: 'showHeader', title: '显示头', type: 'radio', data: BooleanData, default: true},
    // {field: 'func', title: '功能点', type: 'divider'},
    {field: 'funcList', title: '功能点', type: 'select', change(value, meta, model) {
            EventBus.publish(FunEventType.addTableFunc, value)
        }, data: TableFuncMetas, mode: 'multiple', default: ['edit', 'del']
    }
]

const htmlTableFieldMetas = [
    {field: 'title', title: '标题', type: 'text'},
    {field: 'field', title: '字段名', type: 'text', disabled: true},
    {field: 'width', title: '宽度', type: 'number'},
    {field: 'align', title: '对齐方式', type: 'radio', data: alignData, default: 'center'},
    // {field: 'sortOrder', title: '是否排序', type: 'radio', data: sortData, default: false},
    {field: 'fixed', title: '是否固定', type: 'radio', data: tableFixedData, default: false, change(val, meta, model) {
            EventBus.publish(EventType.fixedColumn, meta)
        }},
    {field: 'order', title: '列顺序', type: 'order'}
]

export const htmlTableTabMetas = {
    basic: {label: '基础配置', metas: [...TableMetas]}
}

export const htmlTableFieldTabMetas = {
    basic: {label: '基础配置', metas: [...htmlTableFieldMetas]}
}